package com.woniuxy.oldmanapi.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.woniuxy.oldmanapi.entity.OlderGlu;
import com.woniuxy.oldmanapi.mapper.OlderGluMapper;
import com.woniuxy.oldmanapi.vo.GluVo;
import com.woniuxy.oldmanapi.vo.HeightVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class GluService {

    @Autowired
    OlderGluMapper olderGluMapper ;

    public PageInfo<GluVo> findGluByPage(Integer now, Integer size, String name) {
        PageHelper.startPage(now,size);
        List<GluVo> GluVoList =  olderGluMapper.selectGluByName(name);
        return new PageInfo<>(GluVoList);
    }

    public void add(OlderGlu olderGlu) {
        olderGluMapper.insert(olderGlu);
    }

    public void delete(int id) {
        olderGluMapper.deleteByPrimaryKey(id);
    }

    public void modify(OlderGlu olderGlu) {
        olderGluMapper.updateByPrimaryKey(olderGlu);
    }
    public GluVo selectOne(int id) {
        return olderGluMapper.selectOneByName(id);
    }
}
